package operator.condition;

import io.reactivex.Observable;
import io.reactivex.functions.Predicate;
import util.RxJavaHelper;

class AllOperator {

    public static void main(String[] args) {
        all();
    }

    /**
     * 判断事件序列是否全部满足某个条件，如果是返回true
     */
    static void all() {
        Observable.just(1, 2, 3, 4)
                .all(new Predicate<Integer>() {
                    @Override
                    public boolean test(Integer integer) throws Exception {
                        return integer > 0;
                    }
                })
                .subscribe(RxJavaHelper.getSingleConsumer());
    }


}
